home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Macromedia Multimedia Showcase 6.0
/
Macromedia Multimedia Showcase v6.0 WIN-MAC (XMSH60CD)(Macromedia, Inc.)(1996).iso
/
pc
/
demosoft
/
xres
/
data.z
/
RESOURCE.PS
< prev
next >
Wrap
Text File
|
1996-03-29
|
11KB
|
344 lines
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% resources.ps: this file defines the category implementations %%
%% for the resource categories that are `built in', apart from %%
%% implicit resources, which are handled internally by the %%
%% interpreter. We set the ball rolling by building the %%
%% implementation dictionary for Category and installing it with %%
%% initresouces. After that we can install all the other resource %%
%% categories without any special trickery. %%
%% %%
%% Resources are an unforunate grey area between the interpreter's %%
%% guts and `user-level' PS code. Some magic must be used to get %%
%% resources off to a good start. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% So here we go. The implementation of Category is used to create %%
%% new resource categories. Things are reasonably simple since all %%
%% instances of Category live in global VM. Implicit resources are %%
%% handled specially by the interpreter and don't actually appear %%
%% as bona-fide categories with implementation dictionaries. This %%
%% will only hurt if people say things like: %%
%% /Frog /Filter /Category findresource defineresource %%
%% %%
%% The file names below are UNIX specific. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
systemdict begin
currentglobal
true setglobal
<<
/Category /Category
/InstanceType /dicttype
/DefineResource {
dup /DefineResource known
1 index /UndefineResource known and
1 index /FindResource known and
1 index /ResourceStatus known and
1 index /ResourceForAll known and
1 index /Category known and {
dup /Instances 8 dict put
readonly
Instances 3 -1 roll 2 index put
} {
errodict /typecheck get exec
} ifelse
}
/UndefineResource {
dup ResourceStatus {
pop 2 ne {
Instances exch undef
}
} {
pop
} ifelse
}
/ResourceFileName {
dup 0 (%resource%Category/) dup length 4 1 roll putinterval
2 index length
4 copy getinterval cvs pop
add 0 exch getinterval exch pop
}
/FindResource {
ImplicitInstances 1 index known {
ImplicitInstances exch get
} {
Instances 1 index known not {
dup 256 string ResourceFileName
dup status {
pop pop pop pop
currentglobal exch true setglobal
mark exch {run} stopped cleartomark
setglobal
} if
} if
Instances 1 index known not {
errordict /undefinedresource get exec
} if
Instances exch get
} ifelse
}
/ResourceStatus {
ImplicitInstances 1 index known
Instances 2 index known or {
pop 0 -1 true
} {
256 string ResourceFileName
dup status {
pop pop pop pop
(r) file 256 string readstring pop
(%%VMusage:) search {
pop pop 2 exch
token pop exch token pop exch pop
2 copy lt {exch} if pop
true
} {
pop 2 -1 true
} ifelse
} {
pop false
} ifelse
} ifelse
}
/ResourceForAll {
10 dict begin
/scratch exch def
/proc exch def
/template exch def
ImplicitInstances {
pop scratch cvs dup template stringmatch {
/proc load exec
} {
pop
} ifelse
} forall
Instances {
pop scratch cvs dup template stringmatch {
/proc load exec
} {
pop
} ifelse
} forall
end
}
/ImplicitInstances <<
/Filter dup
/ColorSpaceFamily dup
/Emulator dup
/IODevice dup
/ColorRenderingType dup
/FMapType dup
/FontType dup
/FormType dup
/HalftoneType dup
/ImageType dup
/PatternType dup
>>
>> initresources
setglobal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Now load in the resources that need to be defined in VM. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/Encoding /Category findresource pop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Read in the Encoding resources that the PLRM requires. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
systemdict /StandardEncoding
/StandardEncoding /Encoding findresource put
systemdict /ISOLatin1Encoding
/ISOLatin1Encoding /Encoding findresource put
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% The Distiller device class can recognise standard encodings only %%
%% if they are loaded into memory. So you should uncomment the %%
%% following lines if you are using it. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/MacRomanEncoding /Encoding findresource pop
/WinAnsiEncoding /Encoding findresource pop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% We want the font category in VM as well. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/Font /Category findresource pop
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% Below here go utility procedures that are at least distantly %%
%% related to resources. findencodig and findcharstring are %%
%% needed for compatibility with old-style composite fonts. %%
%% %%
%% findcolorrendering is as described in the PostScript 2016 %%
%% documentation. %%
%% %%
%% composefont is used to create CID-keyed composite fonts as %%
%% described in the CID font documentation. %%
%% %%
%% We also have to redefine findfont as a procedure and not an %%
%% operator in order to work around a bug in the Adobe printer %%
%% driver to do with multiple master fonts %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/findfont {
findfont
} binddef
/findencoding {
/Encoding findresource
} binddef
/findcharstrings {
/CharStrings findresource
} binddef
/findcolorrendering {
/ColorRendering /ProcSet findresource begin
10 dict begin
/origintent exch def
/intent origintent dup length string cvs def
/device GetPageDeviceName dup length string cvs def
/halftone GetHalftoneName dup length string cvs def
/crd
intent length device length halftone length add add 2 add
string def
crd 0 intent putinterval
crd intent length 16#2e put
crd intent length 1 add device putinterval
crd intent length device length add 1 add 16#2e put
crd intent length device length add 2 add halftone putinterval
crd cvn dup /ColorRendering resourcestatus {
pop pop true
} {
pop origintent GetSubstituteCRD false
} ifelse
end end
} binddef
/composefont {
16 dict begin
/FDepVector exch def
/CMap exch def
/FontName exch def
CMap type /nametype eq {
CMap /CMap findresource
/CMap exch def
} if
CMap /FontMatrices known {
/FontMatrices CMap /FontMatrices get def
} {
/FontMatrices 1 dict def
} ifelse
0 1 FDepVector length 1 sub {
/ind exch def
FDepVector ind get
dup type /nametype eq {
dup /CIDFont resourcestatus {
pop pop /CIDFont findresource
} {
findfont
} ifelse
} if
FontMatrices ind known {
FontMatrices ind get makefont
} if
FDepVector ind 3 -1 roll put
} for
/Encoding [ 0 1 FDepVector length 1 sub {} for ] def
CMap /WMode known {
/WMode CMap /WMode get def
} {
/WMode 0 def
} ifelse
/FontType 0 def
/FMapType 9 def
/FontMatrix matrix def
currentdict /ind undef
currentdict /FontMatrices undef
FontName currentdict end definefont
} binddef
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% %%
%% readhexsfnt is a completely undocumented operator that the %%
%% Windows PostScript driver uses to download a TrueType font. %%
%% Because it's only used by Windows, it's safe to assume platform %%
%% equals 2. %%
%% %%
%% We also have readsfntfile for disc-based TrueType fonts. This is %%
%% only used by the TPro resource code. %%
%% %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/readhexsfnt {
readhexsfnt1
12 dict begin
/FontName exch def
/sfnts exch [ exch ] def
/Platform 2 def
/FontMatrix [1 0 0 1 0 0] def
/FontBBox [-1 -1 1 1] def
/PaintType 0 def
/FontType 42 def
currentdict end
} binddef
/readsfntfile {
readsfntfile1
12 dict begin
/FontName exch def
/sfnts exch def
%% This is messy. Guess the platform (Mac or Windows) based on the
%% byte order of the host machine...
/Platform currentsystemparams /ByteOrder get {2} {1} ifelse def
/FontMatrix [1 0 0 1 0 0] def
/FontBBox [-1 -1 1 1] def
/PaintType 0 def
/FontType 42 def
currentdict end
} binddef
/readCIDsfntfile {
readsfntfile
dup /FontType 11 put
dup /Platform 3 put
} binddef
end % systemdict